package com.translate.web.service.impl;

import com.translate.web.dao.OrderApprovalPicMapper;
import com.translate.entity.OrderApprovalPic;
import com.translate.web.param.contract.IOrderApprovalPicAddParam;
import com.translate.web.service.IOrderApprovalPicService;
import com.basic.service.impl.BaseServiceImpl;

import java.util.ArrayList;
import java.util.List;

import org.springframework.stereotype.Service;


/**
 * 
 * @author 111
 *
 */
@Service
public class OrderApprovalPicServiceImpl extends BaseServiceImpl<OrderApprovalPic> implements IOrderApprovalPicService {
	public OrderApprovalPicServiceImpl(OrderApprovalPicMapper mapper) {
		super(mapper);
	}

	protected Class<OrderApprovalPic> getEntityClass() {
		return OrderApprovalPic.class;
	}

	@Override
	public <Param extends IOrderApprovalPicAddParam> int batchInsert(List<Param> list, int paymentApprovalId,
			int receivablesId) {
		
		if (null == list) {
			return 0;
		}

		List<OrderApprovalPic> ts = new ArrayList<>(); 
		
		OrderApprovalPic pic;
		
		for (Param p : list) {
			
			pic = new OrderApprovalPic();
			
			pic.setApprovalId(paymentApprovalId);
			
			pic.setPic(p.getPic());
			
			pic.setReceivablesId(receivablesId);
			
			ts.add(pic);
		}
		
		return this.batchInsert(ts);
		
	}
}